<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>骡窝窝系统管理平台</title>
    <#include "../common/header.ftl"/>
    <script src="/js/plugins/common.js"></script>
</head>

<body>
<div class="container">
<#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
		<#assign menu = "travel" />
        <#include "../common/menu.ftl" />
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">平台用户管理</h1>
                </div>
            </div>
            <div class="row">
                <!-- 提交分页的表单 -->
                <form id="searchForm" class="form-inline" method="post" action="/travel/list.do">
                    <input type="hidden" name="currentPage" id="currentPage" value="1"/>
                    <div class="form-group">
                    </div>
                    <div class="form-group">
                        <label>关键字</label>
                        <input class="form-control" type="text"
                               name="keyword" value="${(qo.keyword)!}"  placeholder="请输入发布人/景点/标题"/>
                    </div>
                    <div class="form-group">
                        <select class="form-control" id="state" name="state">
                            <option value="-2">全部状态</option>
                            <option value="-1">已拒绝</option>
                            <option value="1">待发布</option>
                        </select>
                        <script>
                            $("#state").val(${qo.state});
                        </script>
                    </div>
                    <div class="form-group">
                        <button id="query" type="button" class="btn btn-success"><i class="icon-search"></i> 查询</button>
                    </div>
                </form>
                <script type="text/javascript">
                    $("#query").click(function () {
                        $("#searchForm").submit();
                    })
                </script>
            </div>
            <div class="row">
                <table class="table">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>标题</th>
                        <th>封面</th>
                        <th>地点</th>
                        <th>作者</th>
                        <th>状态</th>
                        <th></th>
                        <th></th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
					<#list pageInfo.list as entity>
                    <#if entity.state!=0>
                    <tr>
                        <td>${entity_index+1}</td>
                        <td>${entity.title}</td>
                        <td><img src="${(entity.coverUrl)!}" width="30px"/> </td>
                        <td>${entity.place.name}</td>
                        <td>${entity.author.nickName}</td>
                        <td>${entity.stateName}</td>
                        <td>
                            <a role="button" class="btn btn-info btn-xs changeStateBtn" data-tid="${entity.id}" data-state="2">
                                <span class="glyphicon glyphicon-pencil"></span> 发布
                            </a>
                        </td>
                        <td>
                            <a role="button" class="btn btn-primary btn-xs changeStateBtn" data-tid="${entity.id}" data-state="-1">
                                <span class="glyphicon glyphicon-tag"></span> 拒绝
                            </a>
                        </td>
                        <td>
                            <a role="button" class="btn btn-warning btn-xs contentBtn" data-tid="${entity.id}">
                                <span class="glyphicon glyphicon-leaf"></span> 查看文章
                            </a>
                        </td>
                    </tr>
                    </#if>
					</#list>
                    </tbody>
                </table>
               <#include "../common/page.ftl"/>
            </div>
            <div class="modal fade" id="contentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                            <h4 class="modal-title" id="contentModal">查看内容</h4>
                        </div>
                        <div class="modal-body">

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<style>
    #contentModal img{
        width: 100%;
    }
    #contentModal .modal-body{
        max-height: 600px;
        overflow-y: scroll;
    }
</style>
<script type="text/javascript">
    $(".changeStateBtn").click(function () {
        var id = $(this).data("tid");
        var state= $(this).data("state");
        $.post("/travel/changeState.do",{id:id,state:state},function (data) {
            doSuccess();
        })
    });

    $(".contentBtn").click(function () {
        var id = $(this).data("tid");
        $.get("/travel/getContent.do",{id:id},function (data) {
            $("#contentModal .modal-body").html(data.content)
        });
        $("#contentModal").modal("show");
    });
</script>
</body>
</html>
